import requests from "./request.js";
import mockRequest from "./mockAjax.js";
// 三级联动
// /product/getBaseCategoryList

export const productList = () => {
    return requests({
        url: "/product/getBaseCategoryList",
        method: "GET",
    })
}
// 轮播图模拟接口
// /mock/banner
export const lubboList = () => mockRequest({ url: '/banner', method: 'GET' });

// floor数据
// /mock/floor
export const floorList = () => mockRequest({ url: '/floor', method: 'GET' });

// 商品列表接口
// /api/list
export const shopList = (data) => requests({ url: '/list', method: 'POST', data })

// 商品详情接口
// /api/item/{ skuId }
export const detailList = (skuId) => requests({ url: `/item/${skuId}`, method: 'GET' })

// 添加购物车
// /api/cart/addToCart/{ skuId }/{ skuNum }
export const addshopping = (skuId, skuNum) => requests({ url: `/cart/addToCart/${skuId}/${skuNum}`, method: 'POST' })

// 获取购物车列表
// /api/cart/cartList
export const reqcartList = () => requests({ url: `/cart/cartList`, method: 'GET' })

// 删除购物车产品
// /api/cart/deleteCart/{skuId}
export const reqremcartList = (skuId) => requests({ url: `/cart/deleteCart/${skuId}`, method: 'DELETE' })


// 切换商品选中状态接口
// /api/cart/checkCart/{skuID}/{isChecked}
export const reqchecked = (skuId,isChecked) => requests({ url: `/cart/checkCart/${skuId}/${isChecked}`, method: 'GET' })

// 注册接口
// /api/user/passport/register
export const reqregister = (data) => requests({ url: `/user/passport/register`, method: 'POST' ,data})

// 获取验证码
// /api/user/passport/sendCode/{phone}   get
export const reqcode = (phone) => requests({ url: `/user/passport/sendCode/${phone}`, method: 'GET' })

// 登录接口
// /api/user/passport/login
export const reqlogin = (data) => requests({ url: `/user/passport/login`, method: 'POST',data })

// 获取用户信息
// /user/passport/auth/getUserInfo
// /api/user/userAddress/auth/findUserAddressList  get
export const reqgetuserlist = () => requests({ url: `/user/passport/auth/getUserInfo`, method: 'GET' })

// 获取用户地址信息
export const reqgetuserzhidi = () => requests({ url: `/user/userAddress/auth/findUserAddressList`, method: 'GET' })

// 获取商品清单
// /api/order/auth/trade
export const reqgetshopqingdan = () => requests({ url: `/order/auth/trade`, method: 'GET' })

// 提交订单
// /api/order/auth/submitOrder?tradeNo={tradeNo}
export const reqsubmitOrder = (tradeNo,data) => requests({ url: `/order/auth/submitOrder?tradeNo=${tradeNo}`, method: 'POST',data})

// 获取支付信息
// /api/payment/weixin/createNative/{orderId}
export const reqgetcreateNative = (orderId) => requests({ url: `/payment/weixin/createNative/${orderId}`, method: 'GET' })


// 查询支付订单状态
// /api/payment/weixin/queryPayStatus/{orderId}
export const reqgetqueryPayStatus = (orderId) => requests({ url: `/payment/weixin/queryPayStatus/${orderId}`, method: 'GET' })
